package baocuntupian.com.idcard;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

/**
 * Created by 联想 on 2017/6/26.
 */

public class MyRecyclerViewAdapter extends RecyclerView.Adapter<MyRecyclerViewAdapter.MyRecyclerViewHolder> {
    private Context mContext;
    private Bean.ResultBean data;
    public MyRecyclerViewAdapter(Context mContext,Bean.ResultBean data) {
        this.mContext=mContext;
        this.data=data;
    }

    @Override
    public MyRecyclerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View inflate = LayoutInflater.from(mContext).inflate(R.layout.nba_item, parent, false);
        MyRecyclerViewHolder myRecyclerViewHolder = new MyRecyclerViewHolder(inflate);
        return myRecyclerViewHolder;
    }

    @Override
    public void onBindViewHolder(MyRecyclerViewHolder holder, int position) {
        holder.area.setText(data.getArea());
        holder.birthday.setText(data.getBirthday());
        holder.sex.setText(data.getSex());

    }

    @Override
    public int getItemCount() {
        return 1;
    }

    class MyRecyclerViewHolder extends RecyclerView.ViewHolder{
        public TextView area;
        public TextView birthday;
        private TextView  sex;
        public MyRecyclerViewHolder(View itemView) {
            super(itemView);
            area= (TextView) itemView.findViewById(R.id.area);
            birthday= (TextView) itemView.findViewById(R.id.birthday);
            sex= (TextView) itemView.findViewById(R.id.sex);
        }
    }

}
